package com.ch09.controller;

import com.ch09.controller.vo.ResultVO;
import com.ch09.entity.City;
import com.ch09.service.CityService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName CityController
 * @Description TODO
 * @Author Kx
 * @Date 2025/5/18 19:56
 * @Version 1.0
 */
@RestController
public class CityController extends BaseController{
    private CityService cityService;

    public CityController(CityService cityService) {
        this.cityService = cityService;
    }
    /**
     * @author: kx
     * @date: 2025/5/18 19:59
     * @param page : 当前页数
     * @param size : 每页显示的记录数
     * @return com.ch09.controller.vo.ResultVO<com.github.pagehelper.PageInfo<com.ch09.entity.City>>
     * @description: 分页查询所有城市信息
    */
    @GetMapping("/findAll")
    public ResultVO<PageInfo<City>> findAll(@RequestParam("page") int page, @RequestParam("size") int size) {
        return success(cityService.findAll(page, size));
    }
}
